package ws;

import java.net.URI;
import java.net.URISyntaxException;

import model.BusInfo;

public class GoogleMapsRequests {
	
	static final String URL = "http://maps.googleapis.com/maps/api/directions/xml?";
	
	public String getInfoRouteBus(int cod){
		KmlOperation ko = new KmlOperation();
		BusInfo bi = ko.getBusForCode(11);
		int tamanho = 0;
		
		//String[]route = transformRoute(bi.getCoordenates());
		
//		String origin[] = route[0].trim().split(",");
//		String destination[] = route[route.length-1].trim().split(",");
//		String request = URL+"origin="+origin[1]+","+origin[0]+"&destination="+destination[1]+","+destination[0]+"&waypoints=";
//		
//		for(int i=1;i<11;i++){
//			String[] ponto = route[i].trim().split(","); 
//			request = request+ponto[1]+","+ponto[0];
//			if(i<11-1)
//				request=request+"|";
//		}
//		request=request+"&sensor=false";
//		System.out.println(request);
//		System.out.println("Tamanho: "+route.length);
//		URI uri = null;
//		try {
//			uri = new URI(request);
//		} catch (URISyntaxException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//		
		return "";
	}
	
	public String[] transformRoute(String route){
		String[] tRoute = route.split(",0");
//		for(int i=0;i<tRoute.length;i++){
//			System.out.println(tRoute[i]);
//		}
		return tRoute;
	}
	
	public static void main(String args[]){
		new GoogleMapsRequests().getInfoRouteBus(11);
	}
}
